﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) {

        if (e.CommandName.Equals("Page"))
            return;
        int rowIndex = int.Parse(e.CommandArgument.ToString());
        object temp = GridView1.Rows[rowIndex].Cells[0].Text;
        if (GridView1.Rows[rowIndex].RowType == DataControlRowType.DataRow) {
            GridViewRow row = GridView1.Rows[rowIndex];
            string classname = ((Button)row.Cells[0].Controls[0]).Text;
            classname = classname.Replace("View Discussion for ", "");

            System.Web.HttpContext.Current.Response.Redirect("Class.aspx?name="+classname);
        }
    }
}
